<!DOCTYPE html>
<html>

<head>
    <#include "/yq/admin/components/meta.html" />
    <title>蓁奕科技 ${metaTitleSuffix!}</title>
    <#include "/yq/admin/components/stylesheets.html" />
</head>

<body>
    <div id='app'>
        <el-container>
            <#assign menuIndex="3-1" />
            <#include "/yq/admin/components/menu.html" />
            <el-container>
                <#include "/yq/admin/components/header.html" />
                <el-main>
                    <template>
                        <el-table :data="items" style="width: 100%">
                            <!-- <el-table-column prop="id" label="id">
                            </el-table-column> -->
                            <el-table-column prop="cover" label="封面" width="70">
                                <template slot-scope="scope">
                                    <img :src="scope.row.cover" style="max-width: 50px;max-height: 50px;">
                                </template>
                            </el-table-column>
                            <el-table-column prop="title" label="标题">
                            </el-table-column>
                            <el-table-column prop="subtitle" label="副标题">
                            </el-table-column>
                        </el-table>
                        <#include '/components/page.html' />
                    </template>
                </el-main>
            </el-container>
        </el-container>
        <#include "/yq/admin/components/footer.html" />
    </div>
    <#include "/yq/admin/components/scripts.html" />
    <script type="text/javascript">
    var vue = new Vue({
        el: '#app',
        data() {
            return {
                items: toJson(`${items![]}`)
            }
        },
        mounted: function() {
        },
        methods: {
            onAdd() {
                location.href = '/yq/admin/product/info'
            },
            onEdit(info) {
                window.location.href = '/yq/admin/product/info?productId=' + info.id;
            },
            onDelte(info) {
                this.$confirm('确定删除?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    var param = {
                        productId: info.id
                    }
                    axiosRequest(param, '/yq/admin/product/delete', '')
                }).catch(() => {});
            },
            onUpdateOrder(info) {
                var param = {
                    orderId: info.id
                }
                axiosRequest(param, '/yq/admin/order/query', '')
            },
            setHidden(info, val) {
                var params = {
                    id: info.id,
                    isHidden: val
                }
                var success = res => {
                    this.$message({
                        message: '设置成功',
                        type: 'success'
                    });
                    window.location.reload();
                }
                var fail = res => {
                    this.$message.error('设置失败');
                }
                var comp = () => {}
                axiosRequestPro(params, '/yq/admin/product/updateIsHidden', success, fail, comp);
            },
            onDateChange(val) {
                var keys = [
                    { key: 'startDate', value: val[0] },
                    { key: 'endDate', value: val[1] }
                ]
                goPage(1, keys)
            },
        },
        filters: {
            fmt(date) {
                return date
            }
        }
    })
    </script>
    <script>
    // vue.tableData = ${items!};
    </script>
</body>

</html>